<?php
class Application_Model_PagePrivilege extends Core_Model_BaseModel
{
	// Имя таблицы
	protected static $_tableName = 'page_privileges';
	
	
	public static function findByPageId( $pageId )
	{
		$return = array();
		$adapter = Zend_Registry::get('db');
		$select = $adapter->select()
			->from(self::$_tableName)
			->where( "page_id = ?", $pageId );  
		
		$stmt = $adapter->query($select);
		$result = $stmt->fetchAll(Zend_Db::FETCH_OBJ);
		if ( !empty( $result ) ) 
		{
			foreach ( $result as $priv ) {
				$return[] = new self( $priv );
			}
		}        
		return $return;
	}
}
?>
